package com.mer.controller;

import com.mer.entity.Permission;
import com.mer.service.PermissionService;
import com.mer.vo.CommonResult;
import com.mer.vo.PermissionVo;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * @program: IIPhase-project
 * @description:
 * @author: 冯彦凯
 * @create: 2021-10-21 15:55
 **/
@RestController
@RequestMapping("permission")
public class PermissionController {
    @Resource
    private PermissionService permissionService;
    @ApiOperation("查询所有菜单，分页，条件")
    @PostMapping("findAllByPage/{page}/{limit}")
    public CommonResult findAllByPage(@PathVariable("page") Integer page,@PathVariable("limit") Integer limit,@RequestBody PermissionVo permissionVo){
        return permissionService.findAllByPage(page,limit,permissionVo);
    }
    @ApiOperation("新增")
    @PutMapping("insert")
    public CommonResult insert(@RequestBody Permission permission){
        return permissionService.insert(permission);
    }

    @ApiOperation("修改操作")
    @PostMapping("update")
    public CommonResult update(@RequestBody Permission permission){
        return permissionService.update(permission);
    }

    @ApiOperation("根据id删除菜单及其子菜单")
    @PostMapping("deleteById")
    public CommonResult deleteById(
            @RequestBody PermissionVo permissionVo){
        return permissionService.deleteById(permissionVo);
    }
   /* @ApiOperation("左侧菜单栏权限查询")
    @GetMapping("meanList")
    public CommonResult meanList(){
        return permissionService.meanList();
    }*/
}
